package com.itboye.sunsun.adapter;

import java.util.ArrayList;

import com.itboye.sunsun.application.App;
import com.itboye.sunsun.beans.LuntanForumBean.LuntanForumItemBean;
import com.itboye.sunsunhome.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MySpinnerAdapter extends BaseAdapter{
	Context context;
	ArrayList<LuntanForumItemBean> arrayList;
	public MySpinnerAdapter(Context context,ArrayList<LuntanForumItemBean> arrayList){
		this.context=context;
		this.arrayList=arrayList;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return arrayList==null?0:arrayList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return arrayList==null?0:arrayList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		convertView=LayoutInflater.from(context).inflate(R.layout.item_spinner, null);
		TextView textView=(TextView) convertView.findViewById(R.id.text);
		textView.setText(arrayList.get(position).getName());
		return convertView;
	}

}
